<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>招生报名注册</title>
<jsp:include page="/WEB-INF/page/common/_header.jsp"></jsp:include>
</head>
<body ontouchstart>
	<div id="mainBox">
		<div style="padding-top: 25%">
			<form id="submitForm" class="weui_cells weui_cells_form bd-t0 afterNone">
				<div class="page-hd">
					<div class="tcenter"><img class="circle" width="100" height="100" src="<%=basePath %>/images/yxt.png"/></div>
	            	<div class="tcenter">培立实验小学招生报名注册</div>
				</div>
				<div class="weui_cell">
	                <div class="weui_cell_hd tm"><label class="weui_label">账&nbsp;&nbsp;号</label></div>
	                <div class="weui_cell_bd weui_cell_primary">
	                    <input class="weui_input" id="userAccount" name="userAccount" type="number" pattern="[0-9]*" placeholder="输入联系电话">
	                </div>
	            </div>
				<div class="weui_cell">
	                <div class="weui_cell_hd tm"><label class="weui_label">密&nbsp;&nbsp;码</label></div>
	                <div class="weui_cell_bd weui_cell_primary">
	                    <input class="weui_input" id="userPassword" name="userPassword" type="password" placeholder="请输入密码"/>
	                </div>
	            </div>
	            <div class="weui_cell">
	                <div class="weui_cell_hd tm"><label class="weui_label">确认密码</label></div>
	                <div class="weui_cell_bd weui_cell_primary">
	                    <input class="weui_input" id="userPassword1" name="userPassword1" type="password" placeholder="请输入确认密码"/>
	                </div>
	            </div>
	            <div class="weui_btn_area">
			        <a href="javascript:" id="loginSubmit" class="weui_btn weui_btn_primary">注 册</a>
			        <a href="<%=basePath %>/signup/studentLogin">
		                <div class="tm p15 f18">已有账号，去登录</div>
		            </a>
			   </div>
	        </form>
		</div>
	</div>
 <script type="text/javascript">
 	if(!/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
		$("#mainBox").attr("style","width:450px;margin: 0 auto;")
	}
	$("#loginSubmit").click(function() {
		var userAccount = $("#userAccount").val();
		if(userAccount == "") {
			$.toast("登录账号不能为空");
			return false;
    	}
		var userPassword = $("#userPassword").val();
    	if(userPassword == "") {
    		$.toast("登录密码不能为空");
			return false;
    	}
    	var userPassword1 = $("#userPassword1").val();
    	if(userPassword1 == "") {
    		$.toast("确认密码不能为空");
			return false;
    	}
    	if(userPassword != userPassword1) {
    		$.toast("确认密码不一致");
			return false;
    	}
    	$.ajax({
    		url: basePath + "/signup/student/reg",
    		type: 'POST',
    		dataType : "json",
    		data: {
    			userAccount: userAccount,
    			userPassword: userPassword
    		},
    		success: function(data) {
    			if (data.code != "000") {
    				$.toast(data.msg);
    			} else {
    				$.toast("恭喜您注册成功！");
    				var url = basePath + "/signup/" + sessionStorage.getItem("signupType")+"?v="+new Date().getTime();
    				setTimeout("javascript:location.href='"+url+"'", 1000); 
    			}
    		},
    		error: function(data) {
    			alert("系统异常,请联系管理员");
    		}
    	});
	})
	</script>
</body>
</html>